You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running cm:stacks:clone while unauthenticated produced no output at all when showConsoleLogs was false (the default after config:set:log --level info).
Expected:ERROR: Please login to execute this command, csdx auth:login Actual: Silent exit — user has no idea why the command stopped
Root Cause
Two compounding issues in run():
1. progressSupportedModule was set unconditionally at the top of run()
// ❌ Before — ran before any auth checkconfigHandler.set('log.progressSupportedModule','clone');
clone is in PROGRESS_SUPPORTED_MODULES, so setting this put the logger into "progress-bar mode" where showConsoleLogs defaults to false. The Console transport was never added to the winston logger, so log.error(...) only wrote to the log file.
2. Stale value persisted across CLI invocations configHandler.set writes to an encrypted config file on disk. Once set by any run, the value persisted for all subsequent runs — meaning even commands that never called handleClone() (i.e. auth failures) still started with progressSupportedModule: 'clone' from disk, silencing their error output.
Fix
src/commands/cm/stacks/clone.ts
Clear progressSupportedModule to null at the very start of run() — before parse() or any log call — so a fresh logger instance is created without progress-bar mode active.
Re-set it to 'clone' as the first line of handleClone() — so progress-bar mode only activates after authentication passes and the actual clone operation begins.
asyncrun(): Promise<void>{try{// Clear stale value from previous runs — ensures auth errors always reach consoleconfigHandler.set('log.progressSupportedModule',null);// ← NEWconst{ flags }=awaitself.parse(StackCloneCommand);consthandleClone=async()=>{configHandler.set('log.progressSupportedModule','clone');// ← MOVED here
...
};if(isAuthenticated()){handleClone();}else{log.error('Please login...');// ← now always visible}}}
Changes
File
Change
src/commands/cm/stacks/clone.ts
Clear progressSupportedModule at start of run(); move set into handleClone()
test/commands/cm/stacks/clone.test.ts
Un-skip and rewrite two auth error tests; add progressSupportedModule assertions
Test Updates
Test
Change
should exit when not authenticated and no management token aliases
Un-skipped. Stubs configHandler.get to force isAuthenticated() = false, stubs cleanUp, asserts log.error fires with correct message and progressSupportedModule is never set to 'clone'
should exit when management token aliases + branches but not authenticated
Un-skipped. Same pattern
should handle run with authenticated user and all optional flags
Added assertion that progressSupportedModule IS set to 'clone' inside handleClone after auth passes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Running
cm:stacks:clonewhile unauthenticated produced no output at all whenshowConsoleLogswasfalse(the default afterconfig:set:log --level info).Expected:
ERROR: Please login to execute this command, csdx auth:loginActual: Silent exit — user has no idea why the command stopped
Root Cause
Two compounding issues in
run():1.
progressSupportedModulewas set unconditionally at the top ofrun()cloneis inPROGRESS_SUPPORTED_MODULES, so setting this put the logger into "progress-bar mode" whereshowConsoleLogsdefaults tofalse. The Console transport was never added to the winston logger, solog.error(...)only wrote to the log file.2. Stale value persisted across CLI invocations
configHandler.setwrites to an encrypted config file on disk. Once set by any run, the value persisted for all subsequent runs — meaning even commands that never calledhandleClone()(i.e. auth failures) still started withprogressSupportedModule: 'clone'from disk, silencing their error output.Fix
src/commands/cm/stacks/clone.tsprogressSupportedModuletonullat the very start ofrun()— beforeparse()or any log call — so a fresh logger instance is created without progress-bar mode active.'clone'as the first line ofhandleClone()— so progress-bar mode only activates after authentication passes and the actual clone operation begins.Changes
src/commands/cm/stacks/clone.tsprogressSupportedModuleat start ofrun(); move set intohandleClone()test/commands/cm/stacks/clone.test.tsprogressSupportedModuleassertionsTest Updates
should exit when not authenticated and no management token aliasesconfigHandler.getto forceisAuthenticated() = false, stubscleanUp, assertslog.errorfires with correct message andprogressSupportedModuleis never set to'clone'should exit when management token aliases + branches but not authenticatedshould handle run with authenticated user and all optional flagsprogressSupportedModuleIS set to'clone'insidehandleCloneafter auth passesBehaviour
showConsoleLogs: falseERROR: Please login to execute this commandshowConsoleLogs: trueshowConsoleLogs: false